// pages/my/vipOrder/vipOrderDetail.js
const app = getApp()
Page({
  data: {
    goodsInfoShow: true,
    goodsPriceShow: false,
    blackPrice:true,
    actualPriceShow:true,
    orderDetail: {},
    orderId:''
  },
  onLoad: function (options) {
    this.setData({
      orderId:options.orderId,
    })
    this.getCusDetail(options.orderId)
  },
  onShow: function () {

  },
  getCusDetail(orderId){
    let data = {
      orderId
    }
    console.log(data)
    let goodsList = []
    app.request('wx_app/user_order/detail',data,'GET').then(res=>{
      console.log(res)
      if (res.code==1) {
        res.data.orderDetails.forEach(item=>{
          goodsList.push({
            name:item.name,
            url: item.pic,
            num: item.amount,
            price: item.price,
            type: item.des,
            productId:item.productId,
            productType:item.productType,
            actualPrice:item.actualPrice,
            color:item.tagColor,
            companyName:item.productTag,
            isDeleted:item.isDeleted
          })
        })
        this.setData({
          ['orderDetail.goodsPrice']:res.data.orderPrice,
          ['orderDetail.orderNo']:res.data.orderNo,
          ['orderDetail.downTime']:res.data.createTime.split('T')[0],
          ['orderDetail.payWay']:res.data.payWay,
          ['orderDetail.company_name']:res.data.company_name,
          ['orderDetail.accountName']:res.data.accountName,
          ['orderDetail.goodsList']:goodsList,
          actualPriceShow: true,
        })
      }
    })
  },
})